package com.star.starrpc.registry;

/**
 * packageName com.star.starrpc.registry
 *
 * @author zerostart
 * @className LocalRegistry
 * @date 2024/11/17
 * @description
 */

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 本地注册中心
 */
public class LocalRegistry {
    /**
     * 注册中心服务信息
     */
    private static final Map<String, Class<?>> map = new ConcurrentHashMap<>();


    /**
     * 注册服务
     */
    public static void register(String serviceName, Class<?> serviceClass) {
        map.put(serviceName, serviceClass);
    }


    /**
     * 获取服务
     * @param serviceName
     * @return
     */
    public static Class<?> get(String serviceName) {
        return map.get(serviceName);
    }

    /**
     * 删除服务
     */
    public static void remove(String serviceName) {
        map.remove(serviceName);
    }






}
